package utils

import "time"

type value struct {
	Code       int         `json:"code"`
	Data       interface{} `json:"data,omitempty"`
	Serial     string      `json:"serial,omitempty"`
	ServerTime int64       `json:"serverTime"`
}

func GetValue(code int, data interface{}) *value {
	v := new(value)
	v.Code = code
	v.Data = data
	v.ServerTime = GetTimeMillis()
	return v
}

func GetTimeMillis() int64 {
	return time.Now().UnixNano() / 1e6
}

func GetTimeMillsByZone(local *time.Location) int64 {
	return time.Now().In(local).UnixNano() / 1e6
}
